﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="TR_Scholarship.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.TR_Scholarship" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc1" %>
<%@ Register src="../Controls/DatePicker.ascx" tagname="DatePicker" tagprefix="uc2" %>

<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">  

  <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
   <script src="../../Scripts/DatePicker.js" type="text/javascript"></script>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">        
            <script type="text/javascript">
                function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }            
                function openDetails(scholar_seq)
                {
                   radopen("TR_ScholarshipDtls.aspx?Sequence=" + scholar_seq,"RadWindow1");
                }
            </script>    
    </telerik:RadCodeBlock>
    
   <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Panel6">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel6" LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>            
        </AjaxSettings>
    </telerik:RadAjaxManager>    
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="None" Skin="Outlook">
    </telerik:RadAjaxLoadingPanel>       
     
     
    <asp:panel ID="Panel6" runat="server" >
        <table cellpadding="0" cellspacing="0" style="width: 994px">
            <tr>
                <td valign = "top" style="width: 1000px">                    
                    <!-- <uc1:user ID="user1" runat="server" /> -->
                </td>
            </tr>
            <tr>
                <td style="width: 1000px">
                   <div class="moduleDivSlim1000x450">
                <div class="moduleDivBottom1000">
                    <table align="center" width="980px">
                    <tr>
                        <td align="left" class="tableHeader">
                            ทุนการศึกษา
                        </td>
                    </tr>
                    </table>
                        <table align="center" style="width: 962px">
                        <tr>
                            <td>                             
                                <asp:Panel ID="PanelGrid" runat="server" Height="380px" ScrollBars="Auto" 
                                    Visible="true" Width="970px">
                                <telerik:RadGrid ID="RadGrid1" 
                                    runat="server"
                                    AllowAutomaticDeletes="True" 
                                    AllowFilteringByColumn="True" 
                                    AllowMultiRowEdit="True" 
                                    AllowMultiRowSelection="True" 
                                    AllowPaging="True" 
                                    AllowSorting="True" 
                                    AutoGenerateColumns="False" 
                                    EnableAJAX="True" 
                                    EnableAJAXLoadingTemplate="True"
                                    GridLines="None" 
                                    Height="350px"
                                    Width="960px"  
                                    Skin="Outlook"
                                    OnItemCommand="RadGrid1_ItemCommand">
                                    <MasterTableView 
                                        AllowMultiColumnSorting="True" 
                                        CellSpacing="-1" 
                                        ClientDataKeyNames="scholar_seq" 
                                        CommandItemDisplay="Top" 
                                        DataKeyNames="scholar_seq"                                         
                                        NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                            <CommandItemTemplate>
                                                <table width="99%">
                                                    <tr>
                                                        <td align="left">
                                                            <asp:LinkButton ID="AddInstitute" runat="server" CommandName="AddData" 
                                                                Visible="true">
                                                            <img alt="" src="../Images/Buttons/AddRecord.gif" 
                                                                style="border:0px;vertical-align:middle;" /> เพิ่มรายการใหม่
                                                            </asp:LinkButton>
                                                        </td>
                                                        <td align="right">
                                                        </td>
                                                    </tr>
                                                </table>
                                            </CommandItemTemplate>
                                            <Columns>
                                                <telerik:GridTemplateColumn AllowFiltering="false" 
                                                    HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="20px" 
                                                    ShowFilterIcon="false">
                                                    <ItemTemplate>
                                                            <asp:ImageButton ID="cmdEdit" runat="server" CommandName="DataEdit" 
                                                                ImageUrl="../Images/Buttons/Edit.gif" 
                                                                OnClientClick="javascript: return confirm('แก้ไขข้อมูลที่เลือก?');" 
                                                                ToolTip="แก้ไขรายการ" />
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridTemplateColumn AllowFiltering="false" 
                                                    HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="20px" 
                                                    ShowFilterIcon="false">
                                                    <ItemTemplate>
                                                            <asp:ImageButton ID="cmdDelete" runat="server" CommandName="Delete" 
                                                                ImageUrl="../Images/Buttons/Delete.gif" 
                                                                OnClientClick="javascript: return confirm('ลบข้อมูลที่เลือก?');" 
                                                                ToolTip="ลบรายการ" />
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridBoundColumn 
                                                    DataField="scholar_seq" 
                                                    UniqueName="scholar_seq" 
                                                    Visible="false">
                                                </telerik:GridBoundColumn>                                                
                                                
                                                <telerik:GridBoundColumn 
                                                    AutoPostBackOnFilter="true" 
                                                    CurrentFilterFunction="Contains" 
                                                    DataField="edu_year_start" 
                                                    FilterControlWidth="100%" 
                                                    HeaderText="ปีการศึกษา" 
                                                    ShowFilterIcon="false" 
                                                    UniqueName="edu_year_start">
                                                    <HeaderStyle HorizontalAlign="Center" Width="80px" Wrap="False" />
                                                </telerik:GridBoundColumn>
                                                
                                            <telerik:GridBoundColumn 
                                                DataField="scholar_fund_seq" 
                                                HeaderText="รหัส" 
                                                ShowFilterIcon="false"
                                                FilterControlWidth="100%" 
                                                CurrentFilterFunction="Contains" 
                                                AutoPostBackOnFilter="true"
                                                UniqueName="No"
                                                Visible="false">
                                                <HeaderStyle HorizontalAlign="Center" Width="80px" />
                                                <ItemStyle HorizontalAlign="Center" Width="80px"/>
                                            </telerik:GridBoundColumn>                                            
                                            
                                            <telerik:GridTemplateColumn 
                                               AutoPostBackOnFilter="true" 
                                                CurrentFilterFunction="Contains" 
                                                DataField="Name" 
                                                HeaderText="ประเภททุน"
                                                FilterControlWidth="100%"                                                     
                                                ShowFilterIcon="false" 
                                                UniqueName="Name" HeaderStyle-Width="250px">          
                                                <ItemTemplate>              
                                                    <asp:LinkButton ID="cmDetail" runat="server" 
                                                        Text='<%# Eval("scholar_type_descr") %>' 
                                                        OnClientClick='<%# string.Format("return openDetails(\"{0}\");", Eval("scholar_seq")) %>'>
                                                    </asp:LinkButton>
                                                </ItemTemplate>               
                                            </telerik:GridTemplateColumn> 
                                            
                                            <telerik:GridBoundColumn 
                                                DataField="scholar_fund_descr" 
                                                HeaderText="แหล่งทุน" 
                                                ShowFilterIcon="false"
                                                FilterControlWidth="100%" 
                                                CurrentFilterFunction="Contains" 
                                                AutoPostBackOnFilter="true"
                                                UniqueName="scholar_fund_descr">
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <ItemStyle HorizontalAlign="Left" />
                                            </telerik:GridBoundColumn>
                                            
                                            <telerik:GridBoundColumn 
                                                AutoPostBackOnFilter="true" 
                                                CurrentFilterFunction="Contains" 
                                                DataField="edu_degree_name" 
                                                FilterControlWidth="100%" 
                                                HeaderText="ระดับการศึกษา" 
                                                ShowFilterIcon="false" 
                                                UniqueName="edu_degree_name">
                                                <HeaderStyle HorizontalAlign="Center" Wrap="False" />
                                            </telerik:GridBoundColumn>
                                                
                                            <telerik:GridBoundColumn 
                                                AutoPostBackOnFilter="true" 
                                                CurrentFilterFunction="Contains" 
                                                DataField="COUNT_SCHLAR" 
                                                FilterControlWidth="100%" 
                                                HeaderText="จำนวน&lt;BR&gt;ผู้สมัคร" 
                                                ShowFilterIcon="false" 
                                                UniqueName="COUNT_SCHLAR">
                                                <HeaderStyle HorizontalAlign="Center" Width="60px" Wrap="False" />
                                            </telerik:GridBoundColumn>
                                                
                                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                                CurrentFilterFunction="Contains" 
                                                DataField="COUNT_SCHLAR_GRANTED" 
                                                FilterControlWidth="100%" 
                                                HeaderText="จำนวนผู้&lt;BR&gt;ที่ได้รับทุน" 
                                                ShowFilterIcon="false"  
                                                UniqueName="COUNT_SCHLAR_GRANTED">
                                                <HeaderStyle HorizontalAlign="Center" Width="60px" Wrap="False" />
                                            </telerik:GridBoundColumn>
                                             
                                            </Columns>
                                            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                            </MasterTableView>
                                            <ClientSettings AllowColumnHide="True" 
                                                AllowColumnsReorder="True" 
                                                EnableRowHoverStyle="True" 
                                                ReorderColumnsOnClient="True">
                                                <Selecting AllowRowSelect="True" 
                                                EnableDragToSelectRows="true" />                                
                                            </ClientSettings>
                                    </telerik:RadGrid>
                                </asp:Panel>                                
                            </td>
                        </tr>
                        </table>
                        <table align="center" style="width: 960px">
                        <tr>
                         <td style="width: 990px">   
                        <asp:Panel ID="PanelAddData" 
                                runat="server"
                                Height="370px"
                                Visible="false" 
                                width="988px" 
                                align="center"                                
                                ScrollBars="Auto">
                                <ul class="formList890px">
                                 <li>
                                    <table align="center" style="width: 758px" >
                                        <tr>
                                            <td align="left" class="tableDetailHeader" style="width: 970px">
                                                ทุนการศึกษา
                                            </td>
                                        </tr>
                                    </table>
                                </li>
                                <li>
                                <table align="left">
                                <tr>
                                    <td align="left" colspan="2" >
                                        <telerik:RadTextBox 
                                            ID="txtscholarSeq" 
                                            Runat="server"
                                            Visible="false">                                             
                                        </telerik:RadTextBox>   
                                    </td> 
                                </tr>
                                <tr> 
                                    <td align="right">
                                                                                   
                                    </td>
                                    <td align="left">
                                    <asp:CheckBox 
                                            ID="rbStatus" 
                                            runat="server" 
                                            Checked="false"
                                            AutoPostBack="true"                        
                                            Text="ปิดการให้ทุน" 
                                            ForeColor="Red"/>
                                    </td>
                                </tr>   
                                                          
                                <tr>
                                    <td align="right" valign="top">
                                        ประเภททุน :
                                    </td>
                                                
                                    <td align="left" style="width: 443px">
                                       <telerik:RadComboBox 
                                            runat="server" 
                                            ID="cbScholaType" 
                                            AllowCustomText ="true" 
                                            DataTextField="scholar_type_list" 
                                            DataValueField="scholar_type_seq" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange = "onTextChange"
                                            EmptyMessage = "...เลือกรายการ..."
                                            Width="300px" >
                                        </telerik:RadComboBox> 
                                        <span class="validate">*</span>  
                                        <asp:RequiredFieldValidator runat="server" 
                                            ID="RequiredFieldValidator1" 
                                            ControlToValidate="cbScholaType"
                                            ErrorMessage="กรุณากรอกข้อมูลประเภททุน" >
                                        </asp:RequiredFieldValidator>                                   
                                    </td>
                                    <td align="left">
                                       
                                    </td> 
                                </tr>
                                
                                <tr>
                                    <td align ="right" valign ="top" >
                                        <font face="Tahoma">แหล่งทุน 1</font> :
                                    </td>
                                    <td align="left" style="width: 443px">
                                        <telerik:RadComboBox 
                                            runat="server" 
                                            ID="ddlScholarFund1" 
                                            AllowCustomText ="true" 
                                            DataTextField="scholar_fund_descr" 
                                            DataValueField="scholar_fund_seq" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange = "onTextChange"
                                            EmptyMessage = "...เลือกรายการ..."
                                            Width="200px" >
                                        </telerik:RadComboBox>
                                        <span class="validate">*</span>
                                        <asp:RequiredFieldValidator runat="server" 
                                            ID="RequiredFieldValidator3" 
                                            ControlToValidate="ddlScholarFund1"
                                            ErrorMessage="กรุณากรอกข้อมูลแหล่งทุน" >
                                        </asp:RequiredFieldValidator>
                                    </td>                                        
                                    <td align="left">
                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td align ="right" valign ="top" >
                                        <font face="Tahoma">แหล่งทุน 2</font> :
                                    </td>
                                    <td align="left" style="width: 443px">
                                        <telerik:RadComboBox 
                                            runat="server" 
                                            ID="ddlScholarFund2" 
                                            AllowCustomText ="true" 
                                            DataTextField="scholar_fund_descr" 
                                            DataValueField="scholar_fund_seq" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange = "onTextChange"
                                            EmptyMessage = "...เลือกรายการ..."
                                            Width="200px" >
                                        </telerik:RadComboBox>
                                    </td>                                        
                                    
                                </tr>
                                
                                <%--<tr>
                                    <td align ="right" valign ="top" >
                                        <font face="Tahoma">แหล่งเงิน</font> :
                                    </td>
                                    <td align="left" style="width: 443px">
                                        <telerik:RadComboBox 
                                            runat="server" 
                                            ID="ddlBgmSource" 
                                            AllowCustomText ="true" 
                                            DataTextField="bgm_source_name" 
                                            DataValueField="bgm_source_seq" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange = "onTextChange"
                                            EmptyMessage = "...เลือกรายการ..."
                                            Width="300px" >
                                        </telerik:RadComboBox>
                                    </td>  
                                    <td align="left">
                                        <span class="validate">*</span>
                                    </td>                                      
                                </tr>   --%>                             
                                <tr>
                                    <td align ="right" valign ="top" >
                                            <font face="Tahoma">ระดับการศึกษา</font> :</td>
                                    <td align="left" style="width: 443px">
                                        <telerik:RadComboBox 
                                            runat="server" 
                                            ID="cbEduDegrees" 
                                            AllowCustomText ="true" 
                                            DataTextField="Name" 
                                            DataValueField="Sequence" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange = "onTextChange"
                                            EmptyMessage = "...เลือกรายการ..."
                                            Width="400px" >
                                        </telerik:RadComboBox> 
                                        <span class="validate">*</span> 
                                        <asp:RequiredFieldValidator runat="server" 
                                            ID="RequiredFieldValidator2" 
                                            ControlToValidate="cbEduDegrees"
                                            ErrorMessage="กรุณากรอกข้อมูลระดับการศึกษา" >
                                        </asp:RequiredFieldValidator>  
                                    </td>  
                                    <td align="left">
                                        
                                    </td>                                      
                                </tr>
                                <%--<tr>
                                    <td align ="right" valign ="top" >
                                        <font face="Tahoma">เงื่อนไขคุณสมบัติของบุคลากร</font> :
                                    </td>
                                    <td align="left" style="width: 443px">
                                        <telerik:RadTextBox 
                                            ID="txtEmpPreCon" 
                                            Runat="server"  
                                            width="250px" 
                                            MaxLength="254" >
                                        </telerik:RadTextBox>
                                        <asp:button 
                                            id="cmdAddEmpPreCon" 
                                            runat="server" 
                                            Width="180px" 
                                            CssClass="button" 
                                            Text="เพิ่มเงื่อนไขคุณสมบัติบุคลากร"
                                            Height="21px" 
                                            ToolTip="เพิ่มเงื่อนไขคุณสมบัติบุคลากร">
                                        </asp:button>
                                    </td>
                                </tr>--%>
                                <tr>
                                    <td align ="right" valign ="top" >
                                        <font face="Tahoma">เปิดรับสมัครตั้งแต่วันที่</font> :
                                    </td>
                                    <td align="left" style="width: 443px">
                                        <uc2:DatePicker ID="txtDateSignStart" runat="server" />
                                        <span class="validate">*</span>
                                        <font face="Tahoma">ถึง</font> :
                                        <uc2:DatePicker ID="txtDateSignEnd" runat="server" />
                                        <span class="validate">*</span>
                                    </td>                    
                                </tr>  
                           
                                <tr>
                                    <td align ="right" valign ="top" >
                                        <font face="Tahoma">เริ่มให้ทุนตั้งแต่ปีการศึกษา</font> :
                                    </td>
                                    <td align="left" style="width: 443px">
                                         
                                        <telerik:RadNumericTextBox ID="txtYearStart" runat="server" Width="150px" 
                                            DataType="System.Int32">
                                            <NumberFormat DecimalDigits="0" GroupSeparator="" ZeroPattern="n" />
                                        </telerik:RadNumericTextBox>
                                         
                                        <font face="Tahoma">ถึง</font> :
                                       
                                        <telerik:RadNumericTextBox ID="txtYearEnd" runat="server" Width="150px" 
                                            DataType="System.Int32">
                                            <NumberFormat DecimalDigits="0" GroupSeparator="" ZeroPattern="n" />
                                        </telerik:RadNumericTextBox>

                                    </td>                    
                                </tr>                               
                                <tr>
                                    <td align ="right" valign ="top" >
                                            <font face="Tahoma">อบรมที่ประเทศ</font> :
                                    </td>
                                    <td align="left" style="width: 443px">
                                         <telerik:RadComboBox 
                                            runat="server" 
                                            ID="ddlCountry" 
                                            AllowCustomText ="true" 
                                            DataTextField="text" 
                                            DataValueField="value" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange = "onTextChange"
                                            EmptyMessage = "...เลือกรายการ..."
                                            Width="200px" >
                                        </telerik:RadComboBox>
                                        <span class="validate">*</span>
                                        <asp:RequiredFieldValidator runat="server" 
                                            ID="RequiredFieldValidator4" 
                                            ControlToValidate="ddlCountry"
                                            ErrorMessage="กรุณากรอกข้อมูลอบรมที่ประเทศ" >
                                        </asp:RequiredFieldValidator>
                                    </td>   
                                    <td>                                        
                                    </td>
                                </tr>
                                <tr>
                                    <td align ="right" valign ="top" >
                                        <font face="Tahoma">งบตามประกาศ</font> :
                                    </td>
                                    <td align="left" style="width: 443px">
                                        
                                        <telerik:RadNumericTextBox ID="txtBudget" runat="server" Width="150px">
                                        </telerik:RadNumericTextBox>
                                         
                                        <span class="validate">*</span> บาท  
                                        <asp:RequiredFieldValidator runat="server" 
                                            ID="RequiredFieldValidator5" 
                                            ControlToValidate="txtBudget"
                                            ErrorMessage="กรุณากรอกข้อมูลงบตามประกาศ" >
                                        </asp:RequiredFieldValidator>                         
                                    </td>
                                </tr>                
                                                                 
                                <tr>
                                    <td align="left" >                                        
                                        <asp:Label ID="lblError" runat="server" ForeColor="Red" Font-Size="Small" Font-Bold="true" />
                                    </td>                                     
                                </tr>
                                </table>                              
                                </li>
                                </ul>                                    
                                   <table style="width: 927px">
                                    <tr>                                    
                                    <td align="right" style="width: 694px">
                                        <asp:Button ID="btnSave" onclick="btnSave_Click" runat="server" CssClass="button" Text="บันทึก" Width="80px" />   
                                        <asp:Button ID="btnUpdate" onclick="btnUpdate_Click" runat="server" CssClass="button" Visible="false" Text="แก้ไข" Width="80px" />                         
                                    </td>
                                    <td align="left" style="width: 637px">
                                        <asp:Button ID="btnCancel" OnClick="btnCancel_Click" runat="server" CausesValidation="false" CssClass="button" Text="ยกเลิก" Width="80px" />
                                    </td>
                                    </tr>
                                    </table>
                            </asp:Panel>
                        </td>
                        </tr>
                        </table>
                        </div>
                        </div>
                </td>
            </tr>
        </table>
    </asp:panel>
    
     <telerik:RadWindowManager ID="RadWindowManager1" VisibleStatusbar="false" ReloadOnShow="true"
        runat="server" Skin="Vista">
        <Windows>
        <telerik:RadWindow 
            id="RadWindow1" 
            runat="server"        
            showcontentduringload="false"
            VisibleStatusbar="false"
            AutoSize = "true"
            title="รายละเอียดของทุนการศึกษา"      
            Modal="true"
            behaviors="Close">
        </telerik:RadWindow>
    </Windows>        
    </telerik:RadWindowManager> 
    
</asp:Content>
